package excel;

/**
 * Description: point for excel. Eg: A1=0,0 B2=1,1
 * Created by 4790K_NSL on 2017/4/29.
 */
public class ExcelPoint {
    private int x;
    private int y;

    public ExcelPoint(){

    }

    public ExcelPoint(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public void setLocation(int x,int y){
        this.x=x;
        this.y=y;
    }

    public void offset(int x,int y){
        x=this.x+x;
        y=this.y+y;
        if(x<0 || y<0 ){
            throw new RuntimeException("offset error.");
        }
        setLocation(x,y);
    }

    public void offset(ExcelPoint point){
        offset(point.getX(),point.getY());
    }

    @Override
    public String toString() {
        return "ExcelPoint{" +
                "x=" + x +
                ", y=" + y +
                '}';
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }
}
